home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Games / Game Sample Code / ZAM 1.0a13 / CoreSource / ErrMsg.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-16  |  1.0 KB  |  60 lines  |  [TEXT/KAHL]

  1. /*
  2.     9-30-92  • Brigham Stevens
  3.     --------------------------
  4.  
  5.     This contains code for handling an error dialog box.
  6.     This is for debugging only, not for a complete real application type thing.
  7.     
  8.     If you want to display an error code and string, call ErrMsgCode,
  9.     otherwise, for string only, just call ErrMsg.
  10. */
  11.  
  12. #define KEEP_GOING 1
  13. #define DEBUGGER 2
  14. #define EXITTOSHELL 3
  15.  
  16.  
  17.  
  18. void ErrMsgCode(Str255 msg, short code)
  19. /*
  20.     Display the error alert with
  21.     an error code.
  22.     
  23.     This handy alert will also display 
  24.     memerr and reserr for you.
  25. */
  26.     Str31    codeStr;
  27.     Str31    memErrStr;
  28.     Str31    resErrStr;
  29.     short    disposition;
  30.     
  31.     NumToString(code,codeStr);
  32.     NumToString(MemErr,memErrStr);
  33.     NumToString(ResErr,resErrStr);
  34.     
  35.     ParamText(msg, codeStr, memErrStr, resErrStr);
  36.  
  37.     disposition = Alert(128, nil);
  38.     
  39.     switch(disposition)
  40.     {
  41.         case    KEEP_GOING:        return;
  42.         break;
  43.         case    DEBUGGER:        DebugStr("\p Doing a Stack Crawl;sc6");
  44.         break;
  45.         case    EXITTOSHELL:    ExitToShell();
  46.         break;
  47.     }
  48. }
  49.  
  50.  
  51. void ErrMsg(Str255 msg)
  52. /*
  53.     No error code desired.
  54. */
  55. {
  56.     ErrMsgCode(msg, 0);
  57. }
  58.  
  59.